<%-- 
    Document   : freeLab
    Created on : Aug 20, 2012, 9:44:06 PM
    Author     : phong
--%>

<%@page contentType="text/html" pageEncoding="UTF-8"%>
<%@taglib prefix="f" uri="http://java.sun.com/jsf/core"%>
<%@taglib prefix="h" uri="http://java.sun.com/jsf/html"%>
<%@taglib prefix="c" uri="http://java.sun.com/jstl/core_rt"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
    "http://www.w3.org/TR/html4/loose.dtd">
<f:view>
    <html>
        <head>
            <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
            <title>JSP Page</title>
        </head>
        <body>
            <a href="freeLab.jsp">Free Lab</a>&nbsp;|&nbsp;
            <a href="mySignList.jsp">My Sign</a>&nbsp;|&nbsp;
            <a href="report.jsp">Send Report</a>&nbsp;|&nbsp;
            <a href="myReportList.jsp">My Report</a>
            <h1>Free Labs List</h1>  
            <h:form id="freeLabList">                     
                <h:inputText  value="#{labList.useDate}">
                </h:inputText>
                <h:selectOneMenu value="#{labList.timeTableId}">
                    <f:selectItem  itemLabel="T1: 7:30 - 9:30" itemValue="T1"></f:selectItem>
                    <f:selectItem  itemLabel="T2: 9:30 - 11:30" itemValue="T2"></f:selectItem>
                    <f:selectItem  itemLabel="T3: 13:30 - 15:30" itemValue="T3"></f:selectItem>
                    <f:selectItem  itemLabel="T4: 15:30 - 17:30" itemValue="T4"></f:selectItem>
                </h:selectOneMenu>                
                <h:commandButton value="Search" action="search"/>               
                <h:dataTable id="freeLab" value="#{labList.freeLabByTime()}" var="labFree" border="1">
                    <h:column>
                        <f:facet name="header">
                            <h:outputText value="Lab Id"/>
                        </f:facet>
                        <h:outputText value="#{labFree.id}"/>
                    </h:column>
                    <h:column>
                        <f:facet name="header">
                            <h:outputText value="Name"/>
                        </f:facet>
                        <h:outputText value="#{labFree.name}"/>
                    </h:column>
                    <h:column>
                        <f:facet name="header">
                            <h:outputText value="Description"/>
                        </f:facet>
                        <h:outputText value="#{labFree.description}"/>
                    </h:column>
                    <h:column>
                        <f:facet name="header">
                            <h:outputText value="Status"/>
                        </f:facet>
                        <h:outputText value="#{labFree.status}"/>
                    </h:column>
                    <h:column>
                        <f:facet name="header">
                            <h:outputText value="Sign"/>
                        </f:facet>
                        <h:commandLink value="Sign" action="viewSignLab" actionListener="#{signLabBean.viewSignLab}" 
                                       immediate="true" rendered="#{dateUlti.futureDate(dateUlti.getDate(labList.useDate))}">
                            <f:param id="labId" name="labId" value="#{labFree.id}"/>
                            <f:param id="useDate" name="useDate" value="#{labList.useDate}"/>
                            <f:param id="timeTableId" name="timeTableId" value="#{labList.timeTableId}"/>
                        </h:commandLink>
                    </h:column>                    
                </h:dataTable> 
            </h:form>
        </body>
    </html>
</f:view>
